package com.lock.lock_common.api.user;

import com.github.pagehelper.PageInfo;
import com.lock.lock_common.dto.Result;
import com.lock.lock_common.pojo.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;

public interface UserApi {

    /**
     * 根据账号分页查询所有普通用户
     * @param pageNum
     * @param userAccount
     * @return
     */
    @RequestMapping("selectUserLimit")
    Result<PageInfo<User>> selectUserlimit(@RequestParam(value = "pageNum",required = false) Integer pageNum,
                                           @RequestParam(value = "userAccount",required = false)String userAccount);


    /**
     * 根据账号和省市区分页查询经销商
     * @param pageNum
     * @param userAccount
     * @param regionLevel
     * @return
     */
    @RequestMapping("selectAgencyLimit")
    Result<PageInfo<User>> selectAgencylimit(@RequestParam(value = "pageNum",required = false) Integer pageNum,
                                             @RequestParam(value = "userAccount",required = false)String userAccount,
                                             @RequestParam(value = "regionLevel",required = false) Integer regionLevel);


    /**
     * 根据账号和经销商id分页查询经销商人员信息
     * @param pageNum
     * @param userAccount
     * @param agencyId
     * @return
     */
    @RequestMapping("selectAgencyMemberLimit")
    Result<PageInfo<UserAgency>> selectAgencyMember(@RequestParam(value = "pageNum",required = false) Integer pageNum,
                                                    @RequestParam(value = "userAccount",required = false)String userAccount,
                                                    @RequestParam(value = "agencyId",required = false) Integer agencyId);


    /**
     * 根据账号和经销商id分页查询安装人员信息
     * @param pageNum
     * @param userAccount
     * @param agencyId
     * @param blacklist
     * @return
     */
    @RequestMapping("selectInstallerLimit")
    Result<PageInfo<UserInstaller>> selectInstaller(@RequestParam(value = "pageNum",required = false) Integer pageNum,
                                                    @RequestParam(value = "userAccount",required = false)String userAccount,
                                                    @RequestParam(value = "agencyId",required = false) Integer agencyId,
                                                    @RequestParam(value = "auditStatus", required = false) Integer auditStatus,
                                                    @RequestParam(value = "blacklist", required = false) Integer blacklist);

    /**
     * 登陆获取用户基本信息
     * @param userAccount
     * @param userPassword
     * @return
     */
    @RequestMapping("getUserInfo")
    Result<User> getUserInfo(@RequestParam(value = "userAccount",required = false) String userAccount,
                             @RequestParam(value = "userPassword",required = false) String userPassword);

    /**
     * 根据userId查询普通用户或经销商或管理员的信息
     * @param userId
     * @return
     */
    @RequestMapping("selectUserByUserId")
    Result<User> selectUserByUserId(@RequestParam(value = "userId")Integer userId);

    /**
     * 根据id查询经销商人员信息
     * @param agencyMemberId
     * @return
     */
    @RequestMapping("selectMemberById")
    Result<UserAgency> selectMemberById(@RequestParam(value = "agencyMemberId")Integer agencyMemberId);


    /**
     * 根据安装人员id查询该安装人员的信息
     * @param installerId
     * @return
     */
    @RequestMapping("selectInstallerById")
    Result<UserInstaller> selectInstallerById(@RequestParam(value = "installerId")Integer installerId);


    /**
     * 增加普通用户或经销商或管理员的信息
     * @param user
     * @return
     */
    @RequestMapping("addUserSelective")
    boolean addUserSelective(@RequestBody User user);

    /**
     * 添加新的经销商人员数据
     * @param agency
     * @return
     */
    @RequestMapping("addAgencySelective")
    boolean addAgencySelective(@RequestBody UserAgency agency);

    /**
     * 添加安装人员信息
     * @param installer
     * @return
     */
    @RequestMapping("addInstallerSelective")
    boolean addInstallerSelective(@RequestBody UserInstaller installer);

    /**
     * 选择性修改用户基本信息
     * @param user
     * @return
     */
    @RequestMapping("updateUserIdSelective")
    boolean updateUserIdSelective(@RequestBody User user);

    /**
     * 选择性修改经销商人员特有信息
     * @param agency
     * @return
     */
    @RequestMapping("updateMemberSelective")
    boolean updateAgencySelective(@RequestBody UserAgency agency);

    /**
     * 选择性修改安装人员特有信息
     * @param installer
     * @return
     */
    @RequestMapping("updateInstallerSelective")
    boolean updateInstallerSelective(@RequestBody UserInstaller installer);

    /**
     * 查询所有角色
     * @return
     */
    @RequestMapping("selectRole")
    Result<List<UserRole>> selectRole();

    /**
     * 根据roleId查询角色
     * @param roleId
     * @return
     */
    @RequestMapping("selectRoleByRoleId")
    Result<UserRole> selectRoleByRoleId(Integer roleId);

    /**
     * 删除普通用户或经销商
     * @param userId
     * @return
     */
    @RequestMapping("delUser")
    boolean delUser(@RequestParam(value = "userId")Integer userId);

    /**
     * 删除安装人员
     * @param installerId
     * @return
     */
    @RequestMapping("delInstaller")
    boolean delInstaller(@RequestParam(value = "installerId")Integer installerId);

    /**
     * 删除经销商人员
     * @param agencyMemberId
     * @return
     */
    @RequestMapping("delAgency")
    boolean delAgency(@RequestParam(value = "agencyMemberId")Integer agencyMemberId);

    /**
     * 删除、冻结用户（逻辑删除）
     */
    @RequestMapping("delUserById")
    boolean delUserById(@RequestParam(value = "delStatus")Integer delStatus,@RequestParam(value = "userId")Integer userId);


    /**
     * 账号是否存在
     * @param userAccount
     * @return
     */
    @RequestMapping("isExist")
    boolean isExist(@RequestParam(value = "userAccount",required = false)String userAccount,
                    @RequestParam(value = "account",required = false)String account);

    /**
     * 根据账号和手机号判断是否存在该用户
     * @param userAccount
     * @param tellphone
     * @return
     */
    @RequestMapping("forget")
    Integer forget(@RequestParam(value = "userAccount")String userAccount,
                   @RequestParam(value = "tellphone")String tellphone);

    /**
     * 查询获得所有经销商的id和名称
     * @return
     */
    @RequestMapping("selectAllAgency")
    List<User> selectAllAgency();

    /**
     * 查询所有邀请码
     * @return
     */
    @RequestMapping("selectAllInvitedNum")
    List<String> selectAllInvitedNum();

    /**
     * 判断密码是否存在
     * @param userPassword
     * @return
     */
    @RequestMapping("isPassword")
    boolean isPassword(@RequestParam(value = "userPassword")String userPassword,
                           @RequestParam(value = "userId")String userId);

    /**
     *根据账号查询userid
     * @param userAccount
     * @return userid
     */
    @RequestMapping("selectUserId")
    int selectUserId(@RequestParam(value = "userAccount") String userAccount);


}
